home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / Vk / VkVisual.z / VkVisual
Encoding:
Text File  |  2002-10-03  |  51.0 KB  |  1,255 lines

  1.  
  2.  
  3.  
  4. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      VVVVkkkkVVVViiiissssuuuuaaaallll - convenience class for dealing with X11 visuals
  10.  
  11.  
  12. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  13.      #include <Vk/VkVisual.h>
  14.  
  15.  
  16. PPPPUUUUBBBBLLLLIIIICCCC PPPPRRRROOOOTTTTOOOOCCCCOOOOLLLL SSSSUUUUMMMMMMMMAAAARRRRYYYY
  17.    CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss,,,, DDDDeeeessssttttrrrruuuuccccttttoooorrrr
  18.               VkVisual (Widget w = _N_U_L_L, Boolean forceNewCmap=_F_A_L_S_E)
  19.  
  20.               VkVisual (const VkComponent *component,
  21.                         Boolean forceNewCmap=_F_A_L_S_E)
  22.  
  23.               VkVisual (int visualClass, int level=_N_O_R_M_A_L__L_E_V_E_L,
  24.                         int colors=_M_A_X__A_V_A_I_L_A_B_L_E__C_O_L_O_R_S,
  25.                         CARD32 xparentRequested=_T_R_A_N_S_P_A_R_E_N_T__D_O_N_T__C_A_R_E,
  26.                         Boolean forceNewCmap=_F_A_L_S_E)
  27.  
  28.               VkVisual (const _V_k_V_i_s_u_a_l&)
  29.  
  30.               VkVisual &operator =(const _V_k_V_i_s_u_a_l&)
  31.  
  32.               virtual ~VkVisual()
  33.  
  34.  
  35.  
  36.    CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss ---- VVVViiiieeeewwwwKKKKiiiitttt 2222....1111 oooonnnnllllyyyy
  37.               VkVisual (VkScreen *screen,
  38.                         int visualClass, int level=_N_O_R_M_A_L__L_E_V_E_L,
  39.                         int colors=_M_A_X__A_V_A_I_L_A_B_L_E__C_O_L_O_R_S,
  40.                         CARD32 xparentRequested=_T_R_A_N_S_P_A_R_E_N_T__D_O_N_T__C_A_R_E,
  41.                         Boolean forceNewCmap=_F_A_L_S_E)
  42.  
  43.  
  44.  
  45.    SSSSeeeettttttttiiiinnnngggg tttthhhheeee CCCCllllaaaassssssss'''' VVVViiiissssuuuuaaaallll IIIInnnnffffoooorrrrmmmmaaaattttiiiioooonnnn
  46.               virtual Colormap setColormap(Colormap cmap=_N_U_L_L,
  47.                                            Boolean setDefault=_F_A_L_S_E)
  48.  
  49.               virtual void setVisual (Widget w = _N_U_L_L,
  50.                                       Boolean forceNewCmap=_F_A_L_S_E)
  51.  
  52.               virtual void setVisual (const VkComponent *component,
  53.                                       Boolean forceNewCmap=_F_A_L_S_E)
  54.  
  55.               virtual VkVisual::status setVisual
  56.                                      (int visualClass, int level,
  57.                                       int colors, CARD32 transparent,
  58.                                       Boolean forceNewCmap=_F_A_L_S_E)
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  71.  
  72.  
  73.  
  74.    DDDDaaaattttaaaa AAAAcccccccceeeessssssss FFFFuuuunnnnccccttttiiiioooonnnnssss
  75.               virtual int            argCnt() const
  76.  
  77.               virtual ArgList        argList() const
  78.  
  79.               virtual void           argList(Arg *args,
  80.                                              Cardinal *offset) const
  81.  
  82.               inline void            argList(Arg *args, int *offset) const
  83.  
  84.               const char            *className( void ) const
  85.  
  86.               virtual Colormap       colormap() const
  87.  
  88.               virtual Boolean        colormapCreated() const
  89.  
  90.               virtual int            depth() const
  91.  
  92.               virtual int            maxLevel() const
  93.  
  94.               virtual int            minLevel() const
  95.  
  96.               virtual int            numColors() const
  97.  
  98.               virtual Visual        *visual() const
  99.  
  100.               virtual VisualID       visualID() const
  101.  
  102.               virtual const VkVisualInfo  *vkVisualInfo
  103.                                             ( VisualID vis) const
  104.  
  105.               virtual const VkVisualInfo  *vkVisualInfo
  106.                                             ( Visual *vis=_N_U_L_L) const
  107.  
  108.               virtual const VkVisualInfo  *vkVisualInfo
  109.                                             ( const Widget w) const
  110.  
  111.               virtual const VkVisualInfo  *vkVisualInfo
  112.                                             ( int index) const
  113.  
  114.               virtual Window         window() const
  115.  
  116.  
  117.  
  118.    DDDDeeeebbbbuuuuggggggggiiiinnnngggg FFFFuuuunnnnccccttttiiiioooonnnnssss
  119.               virtual const char *indexString(index) const
  120.               virtual const char *planesString(planes) const
  121.               virtual void  printAll() const
  122.               virtual void  print( ) const
  123.               virtual void  print( VisualID vid) const
  124.               virtual void  print( const Visual *vis) const
  125.               virtual void  print( const Widget w) const
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  137.  
  138.  
  139.  
  140.               virtual void  print( int index) const
  141.               virtual void  print( const VkVisualInfo *vis) const
  142.               virtual const char *statusString(status) const
  143.               virtual const char *transparencyString(transparency) const
  144.               virtual const char *visualClassString(int) const
  145.  
  146.  
  147.  
  148.    SSSSttttaaaattttiiiicccc FFFFuuuunnnnccccttttiiiioooonnnnssss
  149.               static Widget visualParent( Widget w, Visual ** )
  150.  
  151.               static void visualParentArgs(Widget parent,
  152.                                            Arg *args, int *cnt)
  153.  
  154.  
  155.  
  156.    EEEEnnnnuuuummmmssss
  157.               enum colors   {_M_A_X__A_V_A_I_L_A_B_L_E__C_O_L_O_R_S}
  158.  
  159.               enum index    {_R_E_S_E_T, _F_I_R_S_T, _N_E_X_T, _L_A_S_T}
  160.  
  161.               enum planes   {_N_O_R_M_A_L__L_E_V_E_L,
  162.                              _O_V_E_R_L_A_Y__L_E_V_E_L, _U_N_D_E_R_L_A_Y__L_E_V_E_L,
  163.                              _M_A_X__O_V_E_R_L_A_Y__L_E_V_E_L, _M_I_N__O_V_E_R_L_A_Y__L_E_V_E_L,
  164.                              _M_A_X__U_N_D_E_R_L_A_Y__L_E_V_E_L, _M_I_N__U_N_D_E_R_L_A_Y__L_E_V_E_L,
  165.                              _A_N_Y__L_E_V_E_L}
  166.  
  167.               enum status   {_F_A_I_L_U_R_E, _S_U_C_C_E_S_S, _A_L_M_O_S_T}
  168.  
  169.               enum transparency
  170.                             {_T_R_A_N_S_P_A_R_E_N_T__N_O_N_E, _T_R_A_N_S_P_A_R_E_N_T__P_I_X_E_L,
  171.                              _T_R_A_N_S_P_A_R_E_N_T__M_A_S_K, _T_R_A_N_S_P_A_R_E_N_T__D_O_N_T__C_A_R_E}
  172.  
  173.  
  174.  
  175. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  176.      Dealing with the interaction between widgets and X11 visuals can get
  177.      complicated.  Some applications either get it wrong, or else stick with
  178.      the default visual when another would be more appropriate.  Code, even
  179.      library code, that assumes default visual attributes is commonplace.
  180.      Such an assumption is especially bad in a library, because libraries must
  181.      work with applications that use non-default visuals.
  182.  
  183.  
  184.      _V_k_V_i_s_u_a_l() makes it easy for an application to set up the X11 visual
  185.      information it needs.  Using _V_k_V_i_s_u_a_l, it is easy to do such things as:
  186.  
  187.      +o    get an existing widget's full visual information.
  188.  
  189.      +o    to pick the best visual for a _S_h_e_l_l or for an entire application by
  190.           describing its semantic characteristics.  This includes such things
  191.           as getting the "deepest overlay visual".
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  203.  
  204.  
  205.  
  206.      +o    get information about the default visual.
  207.  
  208.      +o    deal with actual visuals, default or non-default, in a consistent
  209.           and robust way that works across different kinds of hardware.
  210.  
  211.      +o    Get a suitable window for use when creating a GC or a pixmap.
  212.  
  213.  
  214.      On an SGI workstation, Widget access to the popup or overlay bitplanes is
  215.      by means of non-default X11 visuals.  There are a few things that one
  216.      needs to be careful of when using Xt widgets with non-default visuals.
  217.      (For further information about X11 and Xt handling of visual information,
  218.      see below.)
  219.  
  220.  
  221.      The _V_k_V_i_s_u_a_l class simplifies this task.  Because it simplifies the
  222.      model, _V_k_V_i_s_u_a_l cannot do all possible things.  Applications that have
  223.      more complex needs than those addressed by _V_k_V_i_s_u_a_l will still need to
  224.      use direct Xlib and/or OpenGL calls instead.
  225.  
  226.  
  227.      The _V_k_V_i_s_u_a_l class itself deals with global things, such as:
  228.  
  229.      +o    Associating a single colormap with a single visual
  230.  
  231.      +o    Coordinating X11 visual information with that provided by the root
  232.           window's _S_E_R_V_E_R__O_V_E_R_L_A_Y__V_I_S_U_A_L_S property.
  233.  
  234.  
  235.      Each _V_k_V_i_s_u_a_l instance deals with all of the information pertinent to a
  236.      single visual.  The visual can be set to be:
  237.  
  238.      +o    a caller-defined visual
  239.  
  240.      +o    the same visual a specific widget is using
  241.  
  242.      +o    the same visual a specific ViewKit component is using
  243.  
  244.      +o    the default visual
  245.  
  246.      The visual information can also be reset to a new visual (using
  247.      _s_e_t_V_i_s_u_a_l()), but all old visual information is then lost.  If an
  248.      application will continue to need to refer to both sets of visual
  249.      information, it should create a second _V_k_V_i_s_u_a_l object, not just reset
  250.      the first one.
  251.  
  252.  
  253.      Information such as the colormap or the read-only ArgList are created as
  254.      needed.  Any such information is cached, and reused as appropriate.
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  269.  
  270.  
  271.  
  272. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  273.    VVVVkkkkVVVViiiissssuuuuaaaallll(((())))
  274.            VkVisual(VkComponent *comp, Boolean forceNewCmap=_F_A_L_S_E);
  275.  
  276.  
  277.           Create a _V_k_V_i_s_u_a_l object whose visual attributes match those of
  278.           _c_o_m_p->_b_a_s_e_W_i_d_g_e_t().
  279.  
  280.  
  281.    VVVVkkkkVVVViiiissssuuuuaaaallll(((())))
  282.            VkVisual(Widget w=_N_U_L_L, Boolean forceNewCmap=_F_A_L_S_E);
  283.  
  284.  
  285.           Create a _V_k_V_i_s_u_a_l object whose visual attributes match the widget's.
  286.           If _w is _N_U_L_L, default visual information is set up.
  287.  
  288.  
  289.    VVVVkkkkVVVViiiissssuuuuaaaallll(((())))
  290.            VkVisual (int visualClass, int level=_N_O_R_M_A_L__L_E_V_E_L,
  291.                      int colors=_M_A_X__A_V_A_I_L_A_B_L_E__C_O_L_O_R_S,
  292.                      CARD32 transparency=_T_R_A_N_S_P_A_R_E_N_T__D_O_N_T__C_A_R_E,
  293.                      Boolean forceNewCmap=_F_A_L_S_E)
  294.  
  295.  
  296.           Create a _V_k_V_i_s_u_a_l object as close to the specified calling
  297.           parameters as possible.  For how "close" is determined, see the
  298.           description of _s_e_t_V_i_s_u_a_l(), below.
  299.  
  300.  
  301.    VVVVkkkkVVVViiiissssuuuuaaaallll(((()))) ---- VVVViiiieeeewwwwKKKKiiiitttt 2222....1111 oooonnnnllllyyyy
  302.            VkVisual (VkScreen *screen,
  303.                      int visualClass, int level=_N_O_R_M_A_L__L_E_V_E_L,
  304.                      int colors=_M_A_X__A_V_A_I_L_A_B_L_E__C_O_L_O_R_S,
  305.                      CARD32 transparency=_T_R_A_N_S_P_A_R_E_N_T__D_O_N_T__C_A_R_E,
  306.                      Boolean forceNewCmap=_F_A_L_S_E)
  307.  
  308.  
  309.           Create a _V_k_V_i_s_u_a_l object as close to the specified calling
  310.           parameters as possible on the specified VkScreen.  For how "close"
  311.           is determined, see the description of _s_e_t_V_i_s_u_a_l(), below.
  312.  
  313.  
  314.    VVVVkkkkVVVViiiissssuuuuaaaallll(((())))
  315.            VkVisual (const VkVisual&)
  316.  
  317.  
  318.           This is the copy constructor.
  319.  
  320.  
  321.    VVVVkkkkVVVViiiissssuuuuaaaallll(((())))
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  335.  
  336.  
  337.  
  338.            VkVisual &operator =(const VkVisual&)
  339.  
  340.  
  341.           This is the "operator =" constructor.
  342.  
  343.  
  344.    ~~~~VVVVkkkkVVVViiiissssuuuuaaaallll(((())))
  345.            virtual ~VkVisual();
  346.  
  347.  
  348.           The destructor deletes the instance.  Global information, such as a
  349.           visual/colormap pairing, is undisturbed.
  350.  
  351.  
  352.    eeeennnnuuuummmm ccccoooolllloooorrrrssss
  353.       enum colors {_M_A_X__A_V_A_I_L_A_B_L_E__C_O_L_O_R_S}
  354.  
  355.           Using this for the number of colors in the constructor, or in a
  356.           _s_e_t_V_i_s_u_a_l() call, means that the deepest visual that otherwise
  357.           satisfies the request criteria is considered a match.
  358.  
  359.  
  360.    eeeennnnuuuummmm iiiinnnnddddeeeexxxx
  361.       enum index {_R_E_S_E_T, _F_I_R_S_T, _N_E_X_T, _L_A_S_T}
  362.  
  363.           This is passed to _v_k_V_i_s_u_a_l_I_n_f_o(_i_n_t) or _p_r_i_n_t(_i_n_t) when using it to
  364.           iterate over the visuals list.
  365.  
  366.  
  367.    eeeennnnuuuummmm ppppllllaaaannnneeeessss
  368.       enum planes {_N_O_R_M_A_L__L_E_V_E_L,
  369.                    _O_V_E_R_L_A_Y__L_E_V_E_L, _U_N_D_E_R_L_A_Y__L_E_V_E_L,
  370.                    _M_A_X__O_V_E_R_L_A_Y__L_E_V_E_L, _M_I_N__O_V_E_R_L_A_Y__L_E_V_E_L,
  371.                    _M_A_X__U_N_D_E_R_L_A_Y__L_E_V_E_L, _M_I_N__U_N_D_E_R_L_A_Y__L_E_V_E_L,
  372.                    _A_N_Y__L_E_V_E_L}
  373.  
  374.           This specifies which level bit planes are being requested.  These
  375.           constants do not conflict with any legitimate specific level.  Calls
  376.           to the constructor, or to _s_e_t_V_i_s_u_a_l(), can specify either the
  377.           explicit level required or one of these enum values.
  378.  
  379.           NNNNOOOORRRRMMMMAAAALLLL____LLLLEEEEVVVVEEEELLLL - request for the normal planes
  380.  
  381.           OOOOVVVVEEEERRRRLLLLAAAAYYYY____LLLLEEEEVVVVEEEELLLL - request for any overlay planes
  382.  
  383.           UUUUNNNNDDDDEEEERRRRLLLLAAAAYYYY____LLLLEEEEVVVVEEEELLLL - any underlay planes
  384.  
  385.           MMMMAAAAXXXX____OOOOVVVVEEEERRRRLLLLAAAAYYYY____LLLLEEEEVVVVEEEELLLL - highest available overlay level
  386.  
  387.           MMMMIIIINNNN____OOOOVVVVEEEERRRRLLLLAAAAYYYY____LLLLEEEEVVVVEEEELLLL - lowest available overlay level
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  401.  
  402.  
  403.  
  404.           MMMMAAAAXXXX____UUUUNNNNDDDDEEEERRRRLLLLAAAAYYYY____LLLLEEEEVVVVEEEELLLL - underlay level that is the closest to zero
  405.  
  406.           MMMMIIIINNNN____UUUUNNNNDDDDEEEERRRRLLLLAAAAYYYY____LLLLEEEEVVVVEEEELLLL - underlay level that is the furthest from zero
  407.  
  408.           AAAANNNNYYYY____LLLLEEEEVVVVEEEELLLL - don't care which level
  409.  
  410.  
  411.    eeeennnnuuuummmm ssssttttaaaattttuuuussss
  412.       enum status {_F_A_I_L_U_R_E, _S_U_C_C_E_S_S, _A_L_M_O_S_T}
  413.  
  414.           These are the values that _s_e_t_V_i_s_u_a_l() can return.  It is up to an
  415.           application to notice that it did not get _S_U_C_C_E_S_S, and make
  416.           appropriate adjustments if it needs to.
  417.  
  418.           SSSSUUUUCCCCCCCCEEEESSSSSSSS - the visual found is exactly what was requested.
  419.  
  420.           AAAALLLLMMMMOOOOSSSSTTTT - the visual found is likely to be close enough.  It is up to
  421.           the application to query any attributes it cares about to see
  422.           whether the attribute is acceptable.
  423.  
  424.           FFFFAAAAIIIILLLLUUUURRRREEEE - there was a serious problem, such as could not get the
  425.           right visual class.  This generally means that the default visual
  426.           had to be assigned, rather than what was requested.
  427.  
  428.      The lowest status found in processing any of the parameters is returned.
  429.      I.e. if anything failed, _F_A_I_L_U_R_E.  Else if anything was _A_L_M_O_S_T, then that
  430.      is returned.  _S_U_C_C_E_S_S is returned only if everything succeeded.
  431.  
  432.  
  433.    eeeennnnuuuummmm ttttrrrraaaannnnssssppppaaaarrrreeeennnnccccyyyy
  434.       enum transparency {_T_R_A_N_S_P_A_R_E_N_T__N_O_N_E, _T_R_A_N_S_P_A_R_E_N_T__P_I_X_E_L,
  435.                          _T_R_A_N_S_P_A_R_E_N_T__M_A_S_K, _T_R_A_N_S_P_A_R_E_N_T__D_O_N_T__C_A_R_E}
  436.  
  437.           This is the kind of transparency that is requested.
  438.  
  439.  
  440.    aaaarrrrggggCCCCnnnntttt(((())))
  441.       virtual int argCnt() const
  442.  
  443.           Returns the number of visual arguments that a call to _a_r_g_L_i_s_t() will
  444.           supply.  The number this returns could change in a future release.
  445.  
  446.  
  447.    aaaarrrrggggLLLLiiiisssstttt(((())))
  448.       virtual ArgList argList() const
  449.  
  450.           Returns  pointer to a read-only ArgList, suitable for using in an Xt
  451.           call such as:
  452.  
  453.                    _V_k_V_i_s_u_a_l vis (parent);
  454.                    XtSetValues( w, vis.argList(), vis.argCnt() );
  455.  
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  467.  
  468.  
  469.  
  470.    aaaarrrrggggLLLLiiiisssstttt(((())))
  471.       virtual void argList(Arg *args, Cardinal *offset) const
  472.  
  473.           Appends the visual arguments to the ArgList _a_r_g_s, beginning at
  474.           position  _o_f_f_s_e_t, and then increments the _o_f_f_s_e_t by the number of
  475.           arguments it appended.
  476.  
  477.  
  478.    aaaarrrrggggLLLLiiiisssstttt(((())))
  479.       inline void argList(Arg *args, int *offset) const
  480.  
  481.           An overloaded version of the previous call.  This one takes an int*
  482.           instead of a Cardinal*
  483.  
  484.  
  485.    ccccllllaaaassssssssNNNNaaaammmmeeee(((())))
  486.       const char *className( void ) const
  487.  
  488.           The class name of _V_k_V_i_s_u_a_l is "VkVisual".
  489.  
  490.  
  491.    ccccoooolllloooorrrrmmmmaaaapppp(((())))
  492.       virtual Colormap colormap() const
  493.  
  494.           Returns the colormap associated with this instance of _V_k_V_i_s_u_a_l.  If
  495.           there is no colormap, an empty sharable one will be created.
  496.  
  497.  
  498.    ccccoooolllloooorrrrmmmmaaaappppCCCCrrrreeeeaaaatttteeeedddd(((())))
  499.       virtual Boolean colormapCreated() const
  500.  
  501.           Returns TRUE iff the current colormap was created by _V_k_V_i_s_u_a_l.  This
  502.           can be used by the application to tell whether or not the colormap
  503.           should be destroyed when no longer needed.
  504.  
  505.           Failure to destroy colormaps that _V_k_V_i_s_u_a_l creates causes colormap
  506.           leakage in the X server.  Fortunately, from a practical point of
  507.           view, most applications do not need to be concerned with this:
  508.  
  509.      +o    All created colormaps are deleted when the application terminates.
  510.           Unless a lot of colormaps are being created, this is adequate.
  511.  
  512.      +o    _V_k_V_i_s_u_a_l reuses colormaps.  Unless the application sets
  513.           _f_o_r_c_e_N_e_w_C_o_l_o_r_m_a_p or uses _s_e_t_C_o_l_o_r_m_a_p(), there will be at most one
  514.           colormap for each visual used.  This is normally few enough that
  515.           they can be ignored until they are destroyed when the application
  516.           terminates.
  517.  
  518.      +o    Any _V_k_V_i_s_u_a_l that is constructed by passing it a widget uses the
  519.           colormap from that widget.  Such a colormap should not be explicitly
  520.           destroyed.
  521.  
  522.  
  523.  
  524.  
  525.                                                                         PPPPaaaaggggeeee 8888
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  533.  
  534.  
  535.  
  536.    ddddeeeepppptttthhhh(((())))
  537.       virtual int depth() const
  538.  
  539.           Returns the depth associated with this instance's visual.
  540.  
  541.  
  542.    iiiinnnnddddeeeexxxxSSSSttttrrrriiiinnnngggg(((())))
  543.       const char *indexString(planes) const
  544.  
  545.           Debug function:  print (on stderr) the string equivalent to the
  546.           passed enum value.
  547.  
  548.  
  549.    mmmmaaaaxxxxLLLLeeeevvvveeeellll(((())))
  550.       virtual int maxLevel() const
  551.  
  552.           Returns the maximum framebuffer level for the current screen.
  553.  
  554.  
  555.    mmmmiiiinnnnLLLLeeeevvvveeeellll(((())))
  556.       virtual int minLevel() const
  557.  
  558.           Returns the minimum framebuffer level for the current screen.
  559.  
  560.  
  561.    nnnnuuuummmmCCCCoooolllloooorrrrssss(((())))
  562.       virtual int numColors() const
  563.  
  564.           Returns the number of colors in the colormap associated with this
  565.           instance's visual.
  566.  
  567.  
  568.    ppppllllaaaannnneeeessssSSSSttttrrrriiiinnnngggg(((())))
  569.       const char *planesString(planes) const
  570.  
  571.           Debug function:  print (on stderr) the string equivalent to the
  572.           passed enum value
  573.  
  574.  
  575.    pppprrrriiiinnnntttt(((())))
  576.       void print() const
  577.  
  578.           Debug function:  print (on stderr) the visual information from the
  579.           _V_k_V_i_s_u_a_l instance.
  580.  
  581.  
  582.    pppprrrriiiinnnntttt(((())))
  583.       void print(VisualID vid) const
  584.  
  585.           Debug function:  print (on stderr) the visual information matching
  586.           the Visual ID.
  587.  
  588.  
  589.  
  590.  
  591.                                                                         PPPPaaaaggggeeee 9999
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  599.  
  600.  
  601.  
  602.    pppprrrriiiinnnntttt(((())))
  603.       void print(Visual *vis) const
  604.  
  605.           Debug function:  print (on stderr) the visual information matching
  606.           the X visual.
  607.  
  608.  
  609.    pppprrrriiiinnnntttt(((())))
  610.       void print(Widget w) const
  611.  
  612.           Debug function:  print (on stderr) the visual information matching
  613.           the Widget.
  614.  
  615.  
  616.    pppprrrriiiinnnntttt(((())))
  617.       void print(int index) const
  618.  
  619.           Debug function:  print (on stderr) the visual information matching
  620.           the VkVisual whose index is given.
  621.  
  622.  
  623.    pppprrrriiiinnnntttt(((())))
  624.       void print(const VkVisualInfo *vis) const
  625.  
  626.           Debug function:  print (on stderr) the visual information from _v_i_s.
  627.  
  628.  
  629.    pppprrrriiiinnnnttttAAAAllllllll(((())))
  630.       void printAll() const
  631.  
  632.           Debug function:  print (on stderr) a variety of details about the
  633.           visuals of the current display.
  634.  
  635.  
  636.    sssseeeettttCCCCoooolllloooorrrrmmmmaaaapppp(((())))
  637.       virtual Colormap setColormap(Colormap cmap=_N_U_L_L,
  638.                                 Boolean setDefault=_F_A_L_S_E)
  639.  
  640.           If there is a passed-in colormap, makes it current.  If there is no
  641.           colormap, create a new empty one that matches the current visual.
  642.  
  643.           If _s_e_t_D_e_f_a_u_l_t is True, make the new colormap be the default one for
  644.           the visual associated with this _V_k_V_i_s_u_a_l instance.  Return the now-
  645.           current colormap.
  646.  
  647.  
  648.    sssseeeettttVVVViiiissssuuuuaaaallll(((())))
  649.       virtual void setVisual (Widget w = _N_U_L_L,
  650.                               Boolean forceNewCmap=_F_A_L_S_E)
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.                                                                        PPPPaaaaggggeeee 11110000
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  665.  
  666.  
  667.  
  668.           Resets the _V_k_V_i_s_u_a_l to the visual of the widget or gadget, or if
  669.           _N_U_L_L then the default visual.
  670.  
  671.           If _f_o_r_c_e_N_e_w_C_m_a_p is true, you are guaranteed a new, empty, colormap.
  672.           Otherwise, _V_k_V_i_s_u_a_l will reuse an existing colormap for this visual
  673.           if one is available.  Unless you know you need a new colormap, you
  674.           should leave this _F_A_L_S_E.
  675.  
  676.  
  677.    sssseeeettttVVVViiiissssuuuuaaaallll(((())))
  678.       virtual void setVisual (const VkComponent *component,
  679.                               Boolean forceNewCmap=_F_A_L_S_E)
  680.  
  681.           Resets the _V_k_V_i_s_u_a_l to the visual used by _c_o_m_p_o_n_e_n_t->_b_a_s_e_W_i_d_g_e_t().
  682.  
  683.           If _f_o_r_c_e_N_e_w_C_m_a_p is true, you are guaranteed a new, empty, colormap.
  684.           Otherwise, _V_k_V_i_s_u_a_l will reuse an existing colormap for this visual
  685.           if one is available.  Unless you know you need a new colormap, you
  686.           should leave this _F_A_L_S_E.
  687.  
  688.  
  689.    sssseeeettttVVVViiiissssuuuuaaaallll(((())))
  690.       virtual VkVisual::status setVisual
  691.                              (int visualClass, int level,
  692.                               int colors, CARD32 transparent,
  693.                               Boolean forceNewCmap=_F_A_L_S_E)
  694.  
  695.           Resets the visual to be as close to the specified calling parameters
  696.           as possible.  This function always sets _s_o_m_e visual.  It will set
  697.           the default visual, if there is no better match.
  698.  
  699.  
  700.      +o    visualClass - must be one of the constants from <X11/X.h>
  701.           (StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, or
  702.           DirectColor).
  703.  
  704.           If the application asks for a class that is not supported by the
  705.           current screen, _s_e_t_V_i_s_u_a_l() returns _F_A_I_L_U_R_E and provides the default
  706.           visual.
  707.  
  708.  
  709.      +o    level - _s_e_t_V_i_s_u_a_l() always tries to give you the type of planes you
  710.           asked for (i.e. a specific level, overlay planes, underlay planes,
  711.           or normal planes).
  712.  
  713.           If the value is one of the enum constants, that is used.  Else if
  714.           the value is greater than the maximum level, then the maximum level
  715.           is used.  Else if the value is less than the minimum level, then the
  716.           minimum level is used.  Else the value is a legal explicit level and
  717.           it is used directly.
  718.  
  719.  
  720.  
  721.  
  722.  
  723.                                                                        PPPPaaaaggggeeee 11111111
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  731.  
  732.  
  733.  
  734.           If the requested plane(s) exist for the specified visual class, the
  735.           status is _S_U_C_C_E_S_S.
  736.  
  737.           If the requested plane(s) have no visual of the requested class, but
  738.           there is a normal planes visual of the requested class, then that is
  739.           the visual and the status is _A_L_M_O_S_T.
  740.  
  741.           Otherwise, _s_e_t_V_i_s_u_a_l() sets the default visual, and returns _F_A_I_L_U_R_E.
  742.  
  743.  
  744.      +o    colors - is either _M_A_X__A_V_A_I_L_A_B_L_E__C_O_L_O_R_S or else the actual number of
  745.           colors needed, not counting any transparent pixel.  For example,
  746.           most 2-bit overlays only have 3 colors (and one transparent pixel).
  747.           8-bit visuals have 256 colors, unless there is a transparent pixel.
  748.  
  749.           _s_e_t_V_i_s_u_a_l() tries to get a visual that supports at least the
  750.           requested number of colors.  If it can do that, the status is
  751.           _S_U_C_C_E_S_S.  Otherwise, it does the best it can and the status is
  752.           _A_L_M_O_S_T.
  753.  
  754.  
  755.      +o    transparency - one of _T_R_A_N_S_P_A_R_E_N_T__N_O_N_E, _T_R_A_N_S_P_A_R_E_N_T__P_I_X_E_L,
  756.           _T_R_A_N_S_P_A_R_E_N_T__M_A_S_K, or _T_R_A_N_S_P_A_R_E_N_T__D_O_N_T__C_A_R_E.
  757.  
  758.  
  759.      +o    forceNewCmap - If _f_o_r_c_e_N_e_w_C_m_a_p is true, you are guaranteed a new,
  760.           empty, colormap.  Otherwise, _V_k_V_i_s_u_a_l will reuse an existing
  761.           colormap for this visual if one is available.  Unless you know you
  762.           need a new colormap, you should leave this _F_A_L_S_E.
  763.  
  764.           _s_e_t_V_i_s_u_a_l() tries to get a visual that supports the requested type
  765.           of transparency.  If it can, the status is success.  Otherwise, it
  766.           does the best it can and the status is _A_L_M_O_S_T.
  767.  
  768.  
  769.    ssssttttaaaattttuuuussssSSSSttttrrrriiiinnnngggg(((())))
  770.       const char *statusString(status) const
  771.  
  772.           Debug function:  print (on stderr) the string equivalent to the
  773.           passed enum value.
  774.  
  775.  
  776.    ttttrrrraaaannnnssssppppaaaarrrreeeennnnccccyyyySSSSttttrrrriiiinnnngggg(((())))
  777.       const char *transparencyString(transparency) const
  778.  
  779.           Debug function:  print (on stderr) the string equivalent to the
  780.           passed enum value.
  781.  
  782.  
  783.    vvvviiiissssuuuuaaaallll(((())))
  784.       virtual Visual *visual() const
  785.  
  786.  
  787.  
  788.  
  789.                                                                        PPPPaaaaggggeeee 11112222
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  797.  
  798.  
  799.  
  800.           Returns this instance's visual.
  801.  
  802.  
  803.    vvvviiiissssuuuuaaaallllCCCCllllaaaassssssssSSSSttttrrrriiiinnnngggg(((())))
  804.       const char *visualClassString(int) const
  805.  
  806.           Debug function:  print (on stderr) the string equivalent to the
  807.           passed enum value ("Pseudocolor", etc).
  808.  
  809.  
  810.    vvvviiiissssuuuuaaaallllIIIIDDDD(((())))
  811.       virtual VisualID visualID() const
  812.  
  813.           Returns the visual ID of this instance's visual.
  814.  
  815.  
  816.    vvvviiiissssuuuuaaaallllPPPPaaaarrrreeeennnntttt(((())))
  817.       static Widget visualParent( Widget w, Visual ** )
  818.  
  819.           Returns the first widget, higher in the widget tree, that has a
  820.           visual attribute.  Normally, this widget will be a subclass of
  821.           _S_h_e_l_l, but it could be an _S_g_V_i_s_u_a_l_D_r_a_w_i_n_g_A_r_e_a or any other widget
  822.           that has an _X_m_N_v_i_s_u_a_l resource.
  823.  
  824.  
  825.    vvvviiiissssuuuuaaaallllPPPPaaaarrrreeeennnnttttAAAArrrrggggssss(((())))
  826.       static void visualParentArgs(Widget parent, Arg *args, int *cnt)
  827.  
  828.           This gets a set of visual resources, appropriate to the _p_a_r_e_n_t
  829.           widget.  The resources are copied into _a_r_g_s, and _c_n_t is updated.
  830.           All resources except the visual are copied from the parent.  Visual
  831.           is copied from the _v_i_s_u_a_l_P_a_r_e_n_t(_p_a_r_e_n_t).
  832.  
  833.  
  834.    vvvvkkkkVVVViiiissssuuuuaaaallllIIIInnnnffffoooo(((())))
  835.       virtual const VkVisualInfo *vkVisualInfo( VisualID vid) const
  836.  
  837.           Returns a pointer to the _V_k_V_i_s_u_a_l_I_n_f_o structure associated with the
  838.           visual whose ID is _v_i_d.
  839.  
  840.  
  841.    vvvvkkkkVVVViiiissssuuuuaaaallllIIIInnnnffffoooo(((())))
  842.       virtual const VkVisualInfo *vkVisualInfo( Visual *vis=_N_U_L_L) const
  843.  
  844.           Returns a pointer to the _V_k_V_i_s_u_a_l_I_n_f_o structure associated with the
  845.           specified visual.  If _v_i_s is _N_U_L_L, the current visual is used.
  846.  
  847.  
  848.    vvvvkkkkVVVViiiissssuuuuaaaallllIIIInnnnffffoooo(((())))
  849.       virtual const VkVisualInfo *vkVisualInfo( Widget w) const
  850.  
  851.  
  852.  
  853.  
  854.  
  855.                                                                        PPPPaaaaggggeeee 11113333
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  863.  
  864.  
  865.  
  866.           Returns a pointer to the _V_k_V_i_s_u_a_l_I_n_f_o structure associated with the
  867.           widget's visual.
  868.  
  869.  
  870.    vvvvkkkkVVVViiiissssuuuuaaaallllIIIInnnnffffoooo(((())))
  871.       virtual const VkVisualInfo *vkVisualInfo( int index ) const
  872.  
  873.           Returns a pointer to one of the _V_k_V_i_s_u_a_l_I_n_f_o structures from the
  874.           global list maintained by _V_k_V_i_s_u_a_l.  Possible arguments are:
  875.  
  876.           <<<<nnnnuuuummmmbbbbeeeerrrr>>>> - an integer from 0 to the number of available visuals
  877.           retrieve a pointer to that _V_k_V_i_s_u_a_l_I_n_f_o structure.
  878.  
  879.           RRRREEEESSSSEEEETTTT - resets the global record so that a call to
  880.           _v_k_V_i_s_u_a_l_I_n_f_o(_N_E_X_T) _w_i_l_l _r_e_t_u_r_n _a _p_o_i_n_t_e_r _t_o _t_h_e _f_i_r_s_t _s_t_r_u_c_t_u_r_e.
  881.           _R_e_t_u_r_n_s _N_U_L_L.
  882.  
  883.           FFFFIIIIRRRRSSSSTTTT - returns a pointer to the first structure.
  884.  
  885.           NNNNEEEEXXXXTTTT - returns a pointer to the first structure beyond the
  886.           previously retrieved one, regardless of how it was retrieved.  If
  887.           the previously retrieved structure was the last structure, a _R_E_S_E_T
  888.           is done and a _N_U_L_L pointer is returned.  The next _v_k_V_i_s_u_a_l_I_n_f_o(_N_E_X_T)
  889.           _c_a_l_l _w_i_l_l _r_e_t_r_i_e_v_e (_a _p_o_i_n_t_e_r _t_o) _t_h_e _f_i_r_s_t _s_t_r_u_c_t_u_r_e.
  890.  
  891.           LLLLAAAASSSSTTTT - returns a pointer to the last structure.
  892.  
  893.  
  894.    wwwwiiiinnnnddddoooowwww(((())))
  895.       virtual Window window() const
  896.  
  897.           Returns a window associated with this instance's visual.
  898.  
  899.           VkApp's window is used for that visual.  The root window is used for
  900.           its visual.  For any other X11 visual, a matching new _I_n_p_u_t_O_u_t_p_u_t
  901.           unmapped window will be created the first time a window is needed
  902.           for that particular visual.  Windows will reused later as necessary.
  903.           Separate VkVisual instances will return the same window if the
  904.           instances are for the same X11 visual.
  905.  
  906.           Note that there is no guarantee as to which window you will get
  907.           back, even if you used the _V_k_V_i_s_u_a_l(_w_i_d_g_e_t) constructor.  Typical
  908.           use of this window is as a parameter to create a GC or to call the
  909.           Xpm pixmaps routines (which derive visual information from the
  910.           window they are passed).
  911.  
  912.           Because a window may be re-used, it is important that the
  913.           application not delete it.
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.                                                                        PPPPaaaaggggeeee 11114444
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  929.  
  930.  
  931.  
  932. EEEExxxxaaaammmmpppplllleeeessss ooooffff PPPPuuuuttttttttiiiinnnngggg AAAA WWWWiiiiddddggggeeeetttt IIIInnnn AAAA NNNNoooonnnn----DDDDeeeeffffaaaauuuulllltttt VVVViiiissssuuuuaaaallll
  933.      1)   Using _V_k_V_i_s_u_a_l, putting a single widget in a non-default visual is
  934.           very straight-forward.
  935.  
  936.                Widget p;                // Parent widget
  937.                char *c="Questions";     // Widget's name
  938.                ...
  939.                _V_k_V_i_s_u_a_l vis(p);   // Get the visual info
  940.                XmCreateQuestionDialog
  941.                    (p, c, vis.argList(), vis.argCnt());
  942.               ...
  943.  
  944.  
  945.      _2)   Putting your entire application into a non-default visual is only a
  946.           little more complicated.  See _V_k_A_p_p(_3_X).
  947.  
  948.      3)   Creating a GC of the right depth:
  949.  
  950.               Display *dpy;
  951.               _V_k_V_i_s_u_a_l vis(widget);
  952.               ...
  953.               XCreateGC ( dpy, vis.window(), .... )
  954.  
  955.  
  956.  
  957. RRRREEEEVVVVIIIIEEEEWWWW OOOOFFFF XXXX11111111 VVVVIIIISSSSUUUUAAAALLLL IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN
  958.      Many developers do not quite understand how X and Xt deal with
  959.      information that is related to X11 visuals.  This information is
  960.      important if one is going to put part or all of an application's GUI in a
  961.      non-default visual.  Following is a summary of some of the more important
  962.      points.
  963.  
  964.  
  965.    XXXX11111111 VVVViiiissssuuuuaaaallll AAAAttttttttrrrriiiibbbbuuuutttteeeessss
  966.      X11 does not attach any semantic meaning to a visual.  For example, there
  967.      is no concept of an "overlay visual".  There is, however, a semi-standard
  968.      convention that has been adopted by SGI and by some other workstation
  969.      vendors:
  970.  
  971.      +o    A visual's _l_e_v_e_l is the framebuffer level the visual is associated
  972.           with.  This is a hardware-related term.  It has nothing to do with X
  973.           window stacking order.
  974.  
  975.      +o    Levels less than zero are underlays.  As of this writing (8/96), SGI
  976.           has no hardware that has underlay planes that are supported by the X
  977.           server.
  978.  
  979.      +o    Level zero is the normal planes.  The _d_e_f_a_u_l_t _v_i_s_u_a_l is generally
  980.           (but not necessarily) in the normal planes.
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.                                                                        PPPPaaaaggggeeee 11115555
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  995.  
  996.  
  997.  
  998.      +o    Levels greater than zero are overlay planes.
  999.  
  1000.      +o    Each X11 visual is associated with exactly one _l_e_v_e_l.
  1001.  
  1002.      +o    _S_E_R_V_E_R__O_V_E_R_L_A_Y__V_I_S_U_A_L_S is a property on the root window, relating
  1003.           each X11 visual to its _l_e_v_e_l.
  1004.  
  1005.  
  1006.      An X11 window has several attributes that need to be consistent when the
  1007.      window is created.  If an application sets these values inconsistently,
  1008.      or if it allows an inconsistent value to be inherited, the X server will
  1009.      return a fatal BBBBaaaaddddMMMMaaaattttcccchhhh error.
  1010.  
  1011.  
  1012.      +o    _X_C_r_e_a_t_e_W_i_n_d_o_w(_3_X) must be passed a consistent visual and depth.
  1013.  
  1014.  
  1015.      +o    Certain fields in the _X_S_e_t_W_i_n_d_o_w_A_t_t_r_i_b_u_t_e_s structure that is passed
  1016.           to _X_C_r_e_a_t_e_W_i_n_d_o_w(_3_X) must be consistent with the visual and depth.
  1017.           The significant fields are:
  1018.  
  1019.           _b_a_c_k_g_r_o_u_n_d _p_i_x_m_a_p - must be _N_U_L_L or of the stated depth.
  1020.  
  1021.           _b_a_c_k_g_r_o_u_n_d _p_i_x_e_l - is used if the background pixmap is _N_U_L_L.  The
  1022.           pixel value must not exceed the colormap size.
  1023.  
  1024.           _b_o_r_d_e_r _p_i_x_m_a_p - must be _N_U_L_L or of the stated depth.
  1025.  
  1026.           _b_o_r_d_e_r _p_i_x_e_l - is used if the border pixmap is _N_U_L_L.  The pixel
  1027.           value must not exceed the colormap size.
  1028.  
  1029.           _c_o_l_o_r_m_a_p - must match the visual.
  1030.  
  1031.      The depth and visual cannot be changed after the window is created.  The
  1032.      _X_S_e_t_W_i_n_d_o_w_A_t_t_r_i_b_u_t_e_s values can  be changed later.
  1033.  
  1034.  
  1035.    XXXXtttt VVVViiiissssuuuuaaaallll HHHHaaaannnnddddlllliiiinnnngggg
  1036.      Xt does not make it easy to achieve the required consistency when dealing
  1037.      with widgets in non-default visuals.  Under the Xt widget model:
  1038.  
  1039.  
  1040.      +o    A gadget does not have any visual resources of its own, because it
  1041.           draws into its parent's window.
  1042.  
  1043.  
  1044.      +o    Each widget class, because it is derived from the _C_o_r_e class, has
  1045.           _b_o_r_d_e_r_P_i_x_m_a_p, _b_o_r_d_e_r_C_o_l_o_r, _c_o_l_o_r_m_a_p, and _d_e_p_t_h attributes.  Each
  1046.           widget instance inherits the values of these attributes from its
  1047.           parent widget.
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.                                                                        PPPPaaaaggggeeee 11116666
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  1061.  
  1062.  
  1063.  
  1064.      +o    If a widget does not have an _X_m_N_v_i_s_u_a_l resource, its visual cannot
  1065.           be explicitly set at creation time.  Most widgets do not have a
  1066.           visual resource, so they _m_u_s_t inherit their visual.  The only way
  1067.           these widgets can be put into a non-default visual is for their
  1068.           widget parent to be in that visual.
  1069.  
  1070.  
  1071.      +o    The only standard widgets that have an _X_m_N_v_i_s_u_a_l resource (and hence
  1072.           an X11 visual) directly associated with them are _S_h_e_l_l and its
  1073.           subclasses.  (Note: there can also  be special widgets, such as the
  1074.           _S_g_V_i_s_u_a_l_D_r_a_w_i_n_g_A_r_e_a widget ( <_S_g_m/_V_i_s_u_a_l_D_r_a_w_i_n_g_A._h> ), that have an
  1075.           associated X11 visual.  Such special widgets are not common.)
  1076.  
  1077.  
  1078.      +o    Any widget that does not have a visual resource explicitly set at
  1079.           creation time inherits its visual from its parent _w_i_n_d_o_w.  For all
  1080.           widgets other than _S_h_e_l_l widgets, the parent window is the parent
  1081.           widget's window.  This results in inheriting a consistent set of
  1082.           values, and there is no problem.
  1083.  
  1084.           However, the situation is different for a _S_h_e_l_l widget.  Its parent
  1085.           window is the _r_o_o_t _w_i_n_d_o_w.  Thus, if the parent widget is using a
  1086.           different visual than the root window's visual, you _m_u_s_t explicitly
  1087.           set at least some of the _S_h_e_l_l's visual resources.  If you do not,
  1088.           you will get an X server BBBBaaaaddddMMMMaaaattttcccchhhh fatal error.
  1089.  
  1090.      To avoid mismatches, ViewKit explicitly sets the visual information for
  1091.      all new _S_h_e_l_l widgets it creates.  This includes all menus and dialogs.
  1092.      _S_h_e_l_l visual attributes are set to, in priority order:
  1093.  
  1094.      +o    If visual information is passed in by the application, it is used.
  1095.  
  1096.      +o    If the widget is a menu, and _u_s_e_O_v_e_r_l_a_y_M_e_n_u_s is set, an appropriate
  1097.           visual is chosen.
  1098.  
  1099.      +o    If the widget is a dialog, and _u_s_e_O_v_e_r_l_a_y_D_i_a_l_o_g_s is set, an
  1100.           appropriate visual is chosen.
  1101.  
  1102.      +o    Otherwise ViewKit sets the _S_h_e_l_l (i.e. menu or dialog) to the widget
  1103.           parent's visual.
  1104.  
  1105.      The net effect is that most ViewKit applications do not need to worry
  1106.      about this.
  1107.  
  1108.      It is possible to place the top shell (VkApp's unrealized shell) in a
  1109.      non-default visual.  Because of the inheritance described above, That
  1110.      effectively resets the visual for the rest of the application.  (See
  1111.      _V_k_A_p_p(_3_X), topics _u_s_e_O_v_e_r_l_a_y_A_p_p_s() and _p_r_e_R_e_a_l_i_z_e_F_u_n_c_t_i_o_n().
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.                                                                        PPPPaaaaggggeeee 11117777
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  1127.  
  1128.  
  1129.  
  1130.      Visual consistency issues are important when creating _S_h_e_l_l widgets.
  1131.      They are also important at other times.  For example, you cannot use a
  1132.      pixmap or a GC at a depth other than the one it was created for.
  1133.  
  1134.  
  1135.    CCCCoooolllloooorrrrmmmmaaaappppssss
  1136.      Pixel values need to be kept consistent.  In general, the same pixel will
  1137.      not be the same color in the various colormaps.  Be sure you use the
  1138.      correct pixel value for the current colormap.
  1139.  
  1140.      The BlackPixel and WhitePixel macros should be avoided.  They do as X11
  1141.      documents and return pixel values suitable for use with the _d_e_f_a_u_l_t
  1142.      colormap.  BlackPixel returns a pixel which is black in the normal planes
  1143.      colormaps, but is generally transparent in overlay colormaps.
  1144.  
  1145.      Another common way to get inconsistent pixel values is for an application
  1146.      to determine a pixel value using the default colormap, and then to use it
  1147.      in a different colormap.  If the pixel exists, you are likely to get the
  1148.      wrong color.  If the pixel does not exist (such as when you try to apply
  1149.      a pixel greater than 3 to a 2-bit overlay colormap), you will get an X
  1150.      protocol error.
  1151.  
  1152.      If you do decide to put widgets in one of the overlay visuals, remember
  1153.      that the colormap may well be smaller than the default one.  And don't
  1154.      forget that pixel 0 is apt to be transparent.
  1155.  
  1156.      Some hardware has a 2-bit level 1 visual, a 2-bit level 2 visual, and a
  1157.      4-bit level 1 visual that are not entirely independent.  The two-bit
  1158.      colormaps will be independent, but they may overlap with the 4-bit
  1159.      colormap.  The framebuffer pixels of the 4-bit visual may overlap with
  1160.      those of the 2-bit visuals.  On such hardware, using the 4-bit visual is
  1161.      discouraged.
  1162.  
  1163.  
  1164.    CCCCoooolllloooorrrrmmmmaaaapppp CCCCoooooooorrrrddddiiiinnnnaaaattttiiiioooonnnn
  1165.      There is no such thing as a system default colormap for any visual other
  1166.      than the default visual.  If a _V_k_V_i_s_u_a_l instance refers to the default
  1167.      visual, it automatically uses the default colormap.  The first _V_k_V_i_s_u_a_l
  1168.      instance that refers to each non-default visual creates a suitable
  1169.      colormap for that visual.  Subsequent _V_k_V_i_s_u_a_l instances that refer to
  1170.      the same visual re-use the colormap the first instance created.  This
  1171.      effectively establishes default colormaps for a single application.
  1172.  
  1173.      There is no supported way for multiple independent applications to
  1174.      cooperate on using a common colormap.  If we get to where there is a
  1175.      default colormap for the various visuals, _V_k_V_i_s_u_a_l will provide it.
  1176.  
  1177.      An application is only guaranteed to have its colormaps installed when it
  1178.      has colormap focus.  Consequently, there may be colormap flashing.  When
  1179.      an application gets colormap focus, all of the colormaps the application
  1180.      has declared get installed (whether or not it actually needs them).
  1181.      These colormaps remain until another application needs to have one of
  1182.  
  1183.  
  1184.  
  1185.                                                                        PPPPaaaaggggeeee 11118888
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. _V_k_V_i_s_u_a_l((((3333xxxx))))                                                      _V_k_V_i_s_u_a_l((((3333xxxx))))
  1193.  
  1194.  
  1195.  
  1196.      them replaced.  Any of your application's windows that need a conflicting
  1197.      colormap will not return to correct colors until your application next
  1198.      gets colormap focus.
  1199.  
  1200.      +o    Override widgets (e.g. pull-down and popup menus) are responsible
  1201.           for installing their own colormaps.  They will not get their
  1202.           colormaps installed - ever - unless the application does something
  1203.           about it.
  1204.  
  1205.      +o    Likewise, overlay dialogs will not get their color maps installed
  1206.           until the dialog gets colormap focus.
  1207.  
  1208.      +o    ViewKit arranges automatic installation of colormaps for the menu
  1209.           and dialog widgets it creates.  Otherwise you must call
  1210.           XSetWMColormapWindows() yourself.
  1211.  
  1212.  
  1213. KKKKNNNNOOOOWWWWNNNN CCCCLLLLAAAASSSSSSSSEEEESSSS TTTTHHHHAAAATTTT UUUUSSSSEEEE TTTTHHHHIIIISSSS CCCCLLLLAAAASSSSSSSS
  1214.      Any ViewKit class that puts up any kind of a _S_h_e_l_l widget uses this
  1215.      class.  That includes _V_k_A_p_p, _V_k_S_i_m_p_l_e_W_i_n_d_o_w, _V_k_F_i_l_e_S_e_t, _V_k_G_r_a_p_h,
  1216.      _V_k_I_c_o_n_B_u_t_t_o_n, _V_k_M_e_t_e_r, _V_k_O_u_t_l_i_n_e, _V_k_H_e_l_p_A_P_I, the _V_k_I_c_o_n* and _V_k_P_i_x_m_a_p*
  1217.      classes, the dialog classes, and the menu classes.
  1218.  
  1219.  
  1220. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  1221.      _V_k_A_p_p(_3), _V_k_D_i_a_l_o_g_M_a_n_a_g_e_r(_3), _V_k_M_e_n_u (_3), _V_k_S_i_m_p_l_e_W_i_n_d_o_w(_3), _V_k_S_u_b_M_e_n_u
  1222.      (_3)
  1223.      _V_i_e_w_K_i_t _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e
  1224.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m, DEC Press, Bob Scheifler and Jim Gettys
  1225.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m _T_o_o_l_k_i_t, DEC Press, Paul Asente and Ralph Swick
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.                                                                        PPPPaaaaggggeeee 11119999
  1252.  
  1253.  
  1254.  
  1255.